unit DocumenSearchWSNormal;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DocumentSearch, DB, JvMemoryDataset, ZDataset,
  ZAbstractRODataset, ZAbstractDataset, ImgList, dwinlock, OleCtrls,
  AcroPDFLib_TLB, ComCtrls, ToolWin, JvExComCtrls, JvToolBar, JvComCtrls,
  ExtCtrls, StdCtrls, JvExControls, JvSpeedButton, Buttons, JvExExtCtrls,
  JvNetscapeSplitter, Menus, JvLabel, JvExStdCtrls, JvEdit, JvValidateEdit,
  SDK_AXLib_TLB;

type
  TFDocumentSearchWSNormal = class(TFDocumentSearch)
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure SB_CerrarClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CreateParams(var Params: TCreateParams); override;
    procedure DisableWindowsKeys(Active:boolean); override;

    procedure CreatePDF(Node: TTreeNode); override;
  end;

implementation

uses F_LogIn, F_Funciones;

{$R *.dfm}

procedure TFDocumentSearchWSNormal.CreatePDF(Node: TTreeNode);
begin
  inherited;
  EliminarArchivo(DestinationFile);
end;

procedure TFDocumentSearchWSNormal.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do begin
    // Form con TitleBar
    Style := (Style OR WS_CAPTION) AND (NOT WS_VISIBLE);
  end;
end;

procedure TFDocumentSearchWSNormal.FormClose(Sender: TObject; var Action: TCloseAction);
var
  FLogIn:TFLogIn;
begin
  FLogIn:= TFLogIn.Create(Self , 0);

    if (FLogIn.ShowModal = mrOk) then
        begin
          DisableWindowsKeys(False);
          ShowControls(True);

          PanelLateral.Enabled:=True;
          Panel_Busqueda.Enabled:=False;
          PanelCerrar.Enabled:= True;
          Action:= caFree;
        end
      else
          Action:= caNone;

      FLogIn.Free;
  //inherited;

end;

procedure TFDocumentSearchWSNormal.DisableWindowsKeys(Active:boolean);
var
  hAcroPDF: HWND;
begin
  with dWinLock do
    begin
      noAltEsc:=Active;
      noAltReturn:=Active;
      noCtrlEsc:=Active;
     // noRButton:=Active;
      noTaskLinks:=Active;
      NoTaskTray:=Active;
      // Disable CTR+SHIFT+S Save AS
      DisableKey(0,83,MOD_CONTROL or MOD_SHIFT, Active);
      // Disable CTR+S Save
      DisableKey(0,83,MOD_CONTROL, Active);
      // Disable CTR+P Save
      DisableKey(0,80,MOD_CONTROL, Active);
      // Disable CTR+D Properties
      DisableKey(0,68,MOD_CONTROL, Active);
      // Disable CTR+O Properties
      DisableKey(0,79,MOD_CONTROL, Active);
      hAcroPDF:= FindWindow('PDFViewer', 'TAcroPDF');
      DisableKey(hAcroPDF,VK_RBUTTON , 0, Active);
    end;
end;

procedure TFDocumentSearchWSNormal.SB_CerrarClick(Sender: TObject);
begin
  Close;
end;

end.
